package com.bwie.bookOrder.service;

import com.bwie.bookOrder.dao.BookMenuOrderDao;
import com.bwie.common.domain.Menu;
import com.bwie.common.domain.Oder;
import com.bwie.common.results.Result;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookOrderServiceImpl implements BookOrderService{
    @Autowired
    BookMenuOrderDao bookMenuOrderDao;

    @Override
    public Result bookMenuOrderList(Oder oder) {
        PageHelper.startPage(oder.getPageNum(),oder.getPageSize());
        List<Oder>menuOrderlist = bookMenuOrderDao.bookMenuOrderList(oder);
        return new Result(200,new PageInfo<>(menuOrderlist),"查询成功");
    }

    @Override
    public Result bookMenuList(Menu menu) {
        PageHelper.startPage(menu.getPageNum(),menu.getPageSize());
        List<Menu>menulist = bookMenuOrderDao.bookMenuList(menu);
        return new Result(200,new PageInfo<>(menulist),"查询成功");
    }

    @Override
    public Result bookMenuInsert(Menu menu) {

        return null;
    }

    @Override
    public Result bookMenuUpdate(Menu menu) {
        return null;
    }

    @Override
    public Result bookMenuOrderInsert(Oder oder) {
        int i=bookMenuOrderDao.insertchongzhi(oder);
        return new Result(200,i,"开卡成功");

    }

    @Override
    public Result bookMenuOrderUndate(Oder oder) {
        return null;
    }
}
